typedef struct node
{
	int data;
	node *next;
}node;

node *InsertSort(void)
{
	int data = 0;
	node *head = NULL, nnd, cur, pre;

	while(1)
	{
		printf("please input the data:\n");
		scanf("%d", &data);
		if(data == 0)
		{
			break;
		}

		nnd = (node *)malloc(sizeof(node));
		nnd->data = data;
		nnd->next = NULL;

		if(head == NULL)
		{
			head = nnd;
			continue;
		}

		if(nnd->data <= head->data)
		{
			nnd->next = head;
			head = nnd;
			continue;
		}

		cur = head;
		while(nnd->data > cur->data && cur->next!=NULL)
		{
			pre = cur;
			cur = cur->next;
		}

		if(cur->data >= nnd->data)
		{
			pre->next = nnd;
			nnd->next = cur;
		}
		else
			cur->next = nnd;
	}

	return head;
}
